package com.dong.samples.dao.Imp;

import java.util.List;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import com.dong.samples.dao.IDAO;
import com.dong.samples.model.User;
@Repository
@Transactional
public class IDAOImpl extends BaseHibernateDAO<User> implements IDAO {
	
	@Autowired
	private SessionFactory sessionFactory;
	
	public Session getSession(){
		return this.sessionFactory.getCurrentSession();
	}
	
	@SuppressWarnings("unchecked")
	@Override
	public List<User> findUser() {
		String hql = "FROM User";
		return this.createQuery(hql).list();
	}

}
